/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.core.util.ObjectUtil
 *  de.felixroske.jfxsupport.FXMLController
 *  javafx.collections.FXCollections
 *  javafx.collections.ObservableList
 *  javafx.event.EventHandler
 *  javafx.fxml.FXML
 *  javafx.fxml.Initializable
 *  javafx.scene.control.Alert
 *  javafx.scene.control.Alert$AlertType
 *  javafx.scene.control.TableColumn
 *  javafx.scene.control.TableView
 *  javafx.scene.control.cell.PropertyValueFactory
 *  javafx.scene.input.KeyCode
 *  javafx.scene.input.KeyEvent
 *  javafx.scene.layout.Pane
 *  javafx.stage.Stage
 *  javafx.util.Callback
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 *  org.springframework.beans.factory.annotation.Autowired
 */
package com.gys.controller.salesReceipts;

import cn.hutool.core.util.ObjectUtil;
import com.gys.common.util.SpringUtil;
import com.gys.controller.BaseController;
import com.gys.controller.dataManger.ControllerManger;
import com.gys.controller.salesReceipts.SalesReceiptsMainController;
import com.gys.data.salesReceipts.GetQueryProductOutData;
import com.gys.view.salesReceipts.ProductQueryView;
import de.felixroske.jfxsupport.FXMLController;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Timer;
import java.util.TimerTask;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.util.Callback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

@FXMLController
public class ProductQueryController
extends BaseController
implements Initializable {
    private static final Logger log = LoggerFactory.getLogger(ProductQueryController.class);
    @FXML
    private Pane pane;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proBarcode;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proSpecs;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proForm;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proCode;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proRegisterNo;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proFactoryName;
    @FXML
    private TableColumn<GetQueryProductOutData, String> prcAmount;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proPlace;
    @FXML
    private TableView<GetQueryProductOutData> tableView;
    @FXML
    private TableColumn<GetQueryProductOutData, String> index;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proName;
    @FXML
    private TableColumn<GetQueryProductOutData, String> proPym;
    private Timer timer = new Timer();
    private ObservableList<GetQueryProductOutData> observableTableList = FXCollections.observableArrayList(new ArrayList());
    @Autowired
    private SalesReceiptsMainController salesReceiptsMainController;

    public void initialize(URL location, ResourceBundle resources) {
        ControllerManger.controllerMap.put(this.getClass().getSimpleName(), this);
        this.index.setCellValueFactory((Callback)new PropertyValueFactory(this.index.getId()));
        this.proCode.setCellValueFactory((Callback)new PropertyValueFactory(this.proCode.getId()));
        this.proName.setCellValueFactory((Callback)new PropertyValueFactory(this.proName.getId()));
        this.prcAmount.setCellValueFactory((Callback)new PropertyValueFactory(this.prcAmount.getId()));
        this.proSpecs.setCellValueFactory((Callback)new PropertyValueFactory(this.proSpecs.getId()));
        this.proFactoryName.setCellValueFactory((Callback)new PropertyValueFactory(this.proFactoryName.getId()));
        this.proPlace.setCellValueFactory((Callback)new PropertyValueFactory(this.proPlace.getId()));
        this.proForm.setCellValueFactory((Callback)new PropertyValueFactory(this.proForm.getId()));
        this.proBarcode.setCellValueFactory((Callback)new PropertyValueFactory(this.proBarcode.getId()));
        this.proRegisterNo.setCellValueFactory((Callback)new PropertyValueFactory(this.proRegisterNo.getId()));
        this.proPym.setCellValueFactory((Callback)new PropertyValueFactory(this.proPym.getId()));
        this.init();
    }

    @Override
    public void init() {
        if (ObjectUtil.isEmpty(this.tableView)) {
            return;
        }
        this.timer.schedule(new TimerTask(){

            @Override
            public void run() {
                ProductQueryView view = SpringUtil.getBean(ProductQueryView.class);
                Stage stage = (Stage)view.getView().getScene().getWindow();
                stage.getScene().setOnKeyReleased((EventHandler)new EventHandler<KeyEvent>(){

                    public void handle(KeyEvent e) {
                        if (e.getCode() == KeyCode.ENTER) {
                            ProductQueryController.this.sureAction();
                        } else if (e.getCode() == KeyCode.ESCAPE) {
                            ProductQueryController.this.cancelAction();
                        }
                        e.consume();
                    }
                });
            }
        }, 1000L);
        List<GetQueryProductOutData> queryProductOutData = this.salesReceiptsMainController.getQueryProductOutData();
        this.observableTableList.clear();
        this.observableTableList = FXCollections.observableArrayList(queryProductOutData);
        this.tableView.setItems(this.observableTableList);
        this.tableView.refresh();
        this.tableView.requestFocus();
        this.tableView.getSelectionModel().select(0);
    }

    @FXML
    private void sureAction() {
        GetQueryProductOutData queryProductOutData = (GetQueryProductOutData)this.tableView.getSelectionModel().getSelectedItem();
        this.salesReceiptsMainController.setProduct(queryProductOutData);
        if (ObjectUtil.isEmpty(queryProductOutData)) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u672a\u9009\u62e9\u5bf9\u5e94\u8bb0\u5f55\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\uff01");
            alert.showAndWait();
            return;
        }
        this.cancelAction();
        this.salesReceiptsMainController.queryProductDetail(queryProductOutData.getProCode(), null);
    }

    @FXML
    private void cancelAction() {
        this.pane.getScene().getWindow().hide();
    }

    public Pane getPane() {
        return this.pane;
    }

    public TableColumn<GetQueryProductOutData, String> getProBarcode() {
        return this.proBarcode;
    }

    public TableColumn<GetQueryProductOutData, String> getProSpecs() {
        return this.proSpecs;
    }

    public TableColumn<GetQueryProductOutData, String> getProForm() {
        return this.proForm;
    }

    public TableColumn<GetQueryProductOutData, String> getProCode() {
        return this.proCode;
    }

    public TableColumn<GetQueryProductOutData, String> getProRegisterNo() {
        return this.proRegisterNo;
    }

    public TableColumn<GetQueryProductOutData, String> getProFactoryName() {
        return this.proFactoryName;
    }

    public TableColumn<GetQueryProductOutData, String> getPrcAmount() {
        return this.prcAmount;
    }

    public TableColumn<GetQueryProductOutData, String> getProPlace() {
        return this.proPlace;
    }

    public TableView<GetQueryProductOutData> getTableView() {
        return this.tableView;
    }

    public TableColumn<GetQueryProductOutData, String> getIndex() {
        return this.index;
    }

    public TableColumn<GetQueryProductOutData, String> getProName() {
        return this.proName;
    }

    public TableColumn<GetQueryProductOutData, String> getProPym() {
        return this.proPym;
    }

    public Timer getTimer() {
        return this.timer;
    }

    public ObservableList<GetQueryProductOutData> getObservableTableList() {
        return this.observableTableList;
    }

    public SalesReceiptsMainController getSalesReceiptsMainController() {
        return this.salesReceiptsMainController;
    }

    public void setPane(Pane pane) {
        this.pane = pane;
    }

    public void setProBarcode(TableColumn<GetQueryProductOutData, String> proBarcode) {
        this.proBarcode = proBarcode;
    }

    public void setProSpecs(TableColumn<GetQueryProductOutData, String> proSpecs) {
        this.proSpecs = proSpecs;
    }

    public void setProForm(TableColumn<GetQueryProductOutData, String> proForm) {
        this.proForm = proForm;
    }

    public void setProCode(TableColumn<GetQueryProductOutData, String> proCode) {
        this.proCode = proCode;
    }

    public void setProRegisterNo(TableColumn<GetQueryProductOutData, String> proRegisterNo) {
        this.proRegisterNo = proRegisterNo;
    }

    public void setProFactoryName(TableColumn<GetQueryProductOutData, String> proFactoryName) {
        this.proFactoryName = proFactoryName;
    }

    public void setPrcAmount(TableColumn<GetQueryProductOutData, String> prcAmount) {
        this.prcAmount = prcAmount;
    }

    public void setProPlace(TableColumn<GetQueryProductOutData, String> proPlace) {
        this.proPlace = proPlace;
    }

    public void setTableView(TableView<GetQueryProductOutData> tableView) {
        this.tableView = tableView;
    }

    public void setIndex(TableColumn<GetQueryProductOutData, String> index) {
        this.index = index;
    }

    public void setProName(TableColumn<GetQueryProductOutData, String> proName) {
        this.proName = proName;
    }

    public void setProPym(TableColumn<GetQueryProductOutData, String> proPym) {
        this.proPym = proPym;
    }

    public void setTimer(Timer timer) {
        this.timer = timer;
    }

    public void setObservableTableList(ObservableList<GetQueryProductOutData> observableTableList) {
        this.observableTableList = observableTableList;
    }

    public void setSalesReceiptsMainController(SalesReceiptsMainController salesReceiptsMainController) {
        this.salesReceiptsMainController = salesReceiptsMainController;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof ProductQueryController)) {
            return false;
        }
        ProductQueryController other = (ProductQueryController)o;
        if (!other.canEqual(this)) {
            return false;
        }
        Pane this$pane = this.getPane();
        Pane other$pane = other.getPane();
        if (this$pane == null ? other$pane != null : !this$pane.equals(other$pane)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proBarcode = this.getProBarcode();
        TableColumn<GetQueryProductOutData, String> other$proBarcode = other.getProBarcode();
        if (this$proBarcode == null ? other$proBarcode != null : !this$proBarcode.equals(other$proBarcode)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proSpecs = this.getProSpecs();
        TableColumn<GetQueryProductOutData, String> other$proSpecs = other.getProSpecs();
        if (this$proSpecs == null ? other$proSpecs != null : !this$proSpecs.equals(other$proSpecs)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proForm = this.getProForm();
        TableColumn<GetQueryProductOutData, String> other$proForm = other.getProForm();
        if (this$proForm == null ? other$proForm != null : !this$proForm.equals(other$proForm)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proCode = this.getProCode();
        TableColumn<GetQueryProductOutData, String> other$proCode = other.getProCode();
        if (this$proCode == null ? other$proCode != null : !this$proCode.equals(other$proCode)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proRegisterNo = this.getProRegisterNo();
        TableColumn<GetQueryProductOutData, String> other$proRegisterNo = other.getProRegisterNo();
        if (this$proRegisterNo == null ? other$proRegisterNo != null : !this$proRegisterNo.equals(other$proRegisterNo)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proFactoryName = this.getProFactoryName();
        TableColumn<GetQueryProductOutData, String> other$proFactoryName = other.getProFactoryName();
        if (this$proFactoryName == null ? other$proFactoryName != null : !this$proFactoryName.equals(other$proFactoryName)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$prcAmount = this.getPrcAmount();
        TableColumn<GetQueryProductOutData, String> other$prcAmount = other.getPrcAmount();
        if (this$prcAmount == null ? other$prcAmount != null : !this$prcAmount.equals(other$prcAmount)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proPlace = this.getProPlace();
        TableColumn<GetQueryProductOutData, String> other$proPlace = other.getProPlace();
        if (this$proPlace == null ? other$proPlace != null : !this$proPlace.equals(other$proPlace)) {
            return false;
        }
        TableView<GetQueryProductOutData> this$tableView = this.getTableView();
        TableView<GetQueryProductOutData> other$tableView = other.getTableView();
        if (this$tableView == null ? other$tableView != null : !this$tableView.equals(other$tableView)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$index = this.getIndex();
        TableColumn<GetQueryProductOutData, String> other$index = other.getIndex();
        if (this$index == null ? other$index != null : !this$index.equals(other$index)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proName = this.getProName();
        TableColumn<GetQueryProductOutData, String> other$proName = other.getProName();
        if (this$proName == null ? other$proName != null : !this$proName.equals(other$proName)) {
            return false;
        }
        TableColumn<GetQueryProductOutData, String> this$proPym = this.getProPym();
        TableColumn<GetQueryProductOutData, String> other$proPym = other.getProPym();
        if (this$proPym == null ? other$proPym != null : !this$proPym.equals(other$proPym)) {
            return false;
        }
        Timer this$timer = this.getTimer();
        Timer other$timer = other.getTimer();
        if (this$timer == null ? other$timer != null : !this$timer.equals(other$timer)) {
            return false;
        }
        ObservableList<GetQueryProductOutData> this$observableTableList = this.getObservableTableList();
        ObservableList<GetQueryProductOutData> other$observableTableList = other.getObservableTableList();
        if (this$observableTableList == null ? other$observableTableList != null : !this$observableTableList.equals(other$observableTableList)) {
            return false;
        }
        SalesReceiptsMainController this$salesReceiptsMainController = this.getSalesReceiptsMainController();
        SalesReceiptsMainController other$salesReceiptsMainController = other.getSalesReceiptsMainController();
        return !(this$salesReceiptsMainController == null ? other$salesReceiptsMainController != null : !(this$salesReceiptsMainController).equals(other$salesReceiptsMainController));
    }

    protected boolean canEqual(Object other) {
        return other instanceof ProductQueryController;
    }

    public int hashCode() {
        int PRIME = 59;
        int result = 1;
        Pane $pane = this.getPane();
        result = result * 59 + ($pane == null ? 43 : $pane.hashCode());
        TableColumn<GetQueryProductOutData, String> $proBarcode = this.getProBarcode();
        result = result * 59 + ($proBarcode == null ? 43 : $proBarcode.hashCode());
        TableColumn<GetQueryProductOutData, String> $proSpecs = this.getProSpecs();
        result = result * 59 + ($proSpecs == null ? 43 : $proSpecs.hashCode());
        TableColumn<GetQueryProductOutData, String> $proForm = this.getProForm();
        result = result * 59 + ($proForm == null ? 43 : $proForm.hashCode());
        TableColumn<GetQueryProductOutData, String> $proCode = this.getProCode();
        result = result * 59 + ($proCode == null ? 43 : $proCode.hashCode());
        TableColumn<GetQueryProductOutData, String> $proRegisterNo = this.getProRegisterNo();
        result = result * 59 + ($proRegisterNo == null ? 43 : $proRegisterNo.hashCode());
        TableColumn<GetQueryProductOutData, String> $proFactoryName = this.getProFactoryName();
        result = result * 59 + ($proFactoryName == null ? 43 : $proFactoryName.hashCode());
        TableColumn<GetQueryProductOutData, String> $prcAmount = this.getPrcAmount();
        result = result * 59 + ($prcAmount == null ? 43 : $prcAmount.hashCode());
        TableColumn<GetQueryProductOutData, String> $proPlace = this.getProPlace();
        result = result * 59 + ($proPlace == null ? 43 : $proPlace.hashCode());
        TableView<GetQueryProductOutData> $tableView = this.getTableView();
        result = result * 59 + ($tableView == null ? 43 : $tableView.hashCode());
        TableColumn<GetQueryProductOutData, String> $index = this.getIndex();
        result = result * 59 + ($index == null ? 43 : $index.hashCode());
        TableColumn<GetQueryProductOutData, String> $proName = this.getProName();
        result = result * 59 + ($proName == null ? 43 : $proName.hashCode());
        TableColumn<GetQueryProductOutData, String> $proPym = this.getProPym();
        result = result * 59 + ($proPym == null ? 43 : $proPym.hashCode());
        Timer $timer = this.getTimer();
        result = result * 59 + ($timer == null ? 43 : $timer.hashCode());
        ObservableList<GetQueryProductOutData> $observableTableList = this.getObservableTableList();
        result = result * 59 + ($observableTableList == null ? 43 : $observableTableList.hashCode());
        SalesReceiptsMainController $salesReceiptsMainController = this.getSalesReceiptsMainController();
        result = result * 59 + ($salesReceiptsMainController == null ? 43 : ($salesReceiptsMainController).hashCode());
        return result;
    }

    public String toString() {
        return "ProductQueryController(pane=" + this.getPane() + ", proBarcode=" + this.getProBarcode() + ", proSpecs=" + this.getProSpecs() + ", proForm=" + this.getProForm() + ", proCode=" + this.getProCode() + ", proRegisterNo=" + this.getProRegisterNo() + ", proFactoryName=" + this.getProFactoryName() + ", prcAmount=" + this.getPrcAmount() + ", proPlace=" + this.getProPlace() + ", tableView=" + this.getTableView() + ", index=" + this.getIndex() + ", proName=" + this.getProName() + ", proPym=" + this.getProPym() + ", timer=" + this.getTimer() + ", observableTableList=" + this.getObservableTableList() + ", salesReceiptsMainController=" + this.getSalesReceiptsMainController() + ")";
    }
}

